package com.demo.designmode.flyweight;

/**
 * @Author: jxm
 * @Description: 享元模式 测试
 * @Date: 2023-11-17 15:16
 * @Version: 1.0
 */
public class Client {

    public static void main(String[] args) {
        AbstractBox box1 = BoxFactory.getInstance().getBox("I");
        box1.display("灰色");

        AbstractBox box2 = BoxFactory.getInstance().getBox("L");
        box2.display("蓝色");

        AbstractBox box3 = BoxFactory.getInstance().getBox("O");
        box3.display("红色");

        AbstractBox box4 = BoxFactory.getInstance().getBox("O");
        box4.display("黄色");

        System.out.println("两次获取的O图形是否一样L："+(box3 == box4));
    }
}
